#ifndef STORAGE_CONNECTION_CONFIG_FACTORY_HPP
#define STORAGE_CONNECTION_CONFIG_FACTORY_HPP

#include "Storage/CommonStorageConfig.hpp"
#include "utils/factory_map.hpp"
#include <boost/function.hpp>
#include <string>
#include <list>

namespace Storage
{

class ConnectionConfig;

namespace Details
{
	typedef NameString ConnectionTypeName;
	typedef ConnectionConfig* ConnectionConfigPtr__;
	typedef boost::function< ConnectionConfigPtr__ ( const NameString& )> ConnectionConfigConstructor;
	typedef utils::factory_map< ConnectionTypeName, ConnectionConfigConstructor> ConnectionConfigFactoryBase;

} // namespace Details

// TODO: Update documentation
/// \ingroup Storage
/// \brief It is the abstract factory to be used for creating connection configurations, based on a given type name.
class COMMON_STORAGE_API ConnectionConfigFactory: private Details::ConnectionConfigFactoryBase
{
public:
	void registerConnCfgConstructor( const NameString& cfgTypeName, const Details::ConnectionConfigConstructor& constructor);

	void getRegisteredConnCfgTypes( std::list< NameString>& result);

	ConnectionConfig* createConfig( const NameString& connTypeName, const NameString& connName) const;
};

} // namespace Storage

#endif // STORAGE_CONNECTION_CONFIG_FACTORY_HPP
